package com.gxg;

import com.gxg.dao.ExperimentalNodeDao;
import com.gxg.dao.NodeGroupDao;
import java.io.PrintStream;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication(exclude={CacheAutoConfiguration.class})
@EnableScheduling
public class ExperimentalPlatformApplication extends SpringBootServletInitializer implements WebApplicationInitializer
{
  @Bean
  public RestTemplate restTemplate() {
    return new RestTemplate();
  }
  public static void main(String[] args)
  {

    ConfigurableApplicationContext context = SpringApplication.run(ExperimentalPlatformApplication.class, args);
    Boolean deleteContinue = Boolean.valueOf(true);
    while (deleteContinue.booleanValue()) {
      try
      {
        ((ExperimentalNodeDao)context.getBean(ExperimentalNodeDao.class)).deleteAll();
        ((NodeGroupDao)context.getBean(NodeGroupDao.class)).deleteAll();
        deleteContinue = Boolean.valueOf(false);
      }
      catch (Exception e)
      {
        System.out.println(e.getMessage());
      }
    }
  }
}
